package com.durian.financial.api.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author zhouzhiyi
 * @Date 2022/6/25 14:03
 * @Description 账户类型枚举
 */
@Getter
public enum AccountTypeEnum {

    UNDEFINED(0,"未定义"), PUBLIC_ACCOUNT(1,"对公账户"),PRIVATE_ACCOUNT(2,"对私账户");

    @EnumValue
    @JsonValue
    private final Integer index;

    private final String value;

    AccountTypeEnum(Integer index, String value) {
        this.index = index;
        this.value = value;
    }


    /**
     * 获取账户类型Map
     *
     * @return Map<Integer,String>
     */
    public static Map<Integer,String> getAccountTypeMap(){

        Map<Integer, String> map = new HashMap<>();

        for (AccountTypeEnum temp : EnumSet.allOf(AccountTypeEnum.class)) {

            map.put(temp.index,temp.value);
        }

        return map;
    }


}
